package com.vcms.cms.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * Perrmission entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "perrmission", catalog = "vcms_0.1")
public class Perrmission implements java.io.Serializable {

	// Fields

	private Integer permissionId;
	private String url;
	private Integer crud;
	private Set<Role> roles = new HashSet<Role>(0);

	// Constructors

	/** default constructor */
	public Perrmission() {
	}

	/** full constructor */
	public Perrmission(String url, Integer crud, Set<Role> roles) {
		this.url = url;
		this.crud = crud;
		this.roles = roles;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "permissionId", unique = true, nullable = false)
	public Integer getPermissionId() {
		return this.permissionId;
	}

	public void setPermissionId(Integer permissionId) {
		this.permissionId = permissionId;
	}

	@Column(name = "url", length = 300)
	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Column(name = "crud")
	public Integer getCrud() {
		return this.crud;
	}

	public void setCrud(Integer crud) {
		this.crud = crud;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "perrmissions")
	public Set<Role> getRoles() {
		return this.roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

}